﻿
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Data.Entity;
using Abp.EntityFramework;
using Abp.Domain.Entities;
using hhg.TaskDomain;

namespace hhg.EntityFramework.Repositories
{
    public class TaskRepository : hhgRepositoryBase<Task, long>, ITaskRepository
    {
        public TaskRepository(IDbContextProvider<hhgDbContext> dbContextProvider)
            : base(dbContextProvider)
        {

        }
        public List<Task> GetAllWithPeople(int? assignedPersonId, TaskState? state)
        {
            var query = GetAll();
            if (assignedPersonId.HasValue)
            {
                query = query.Where(t=>t.AssignedPersonId== assignedPersonId);
            }
            if (state.HasValue)
                query = query.Where(t=>t.State==state);

            return query
                .OrderByDescending(t => t.CreationTime)
                .Include(t => t.AssignedPersonId)
                .ToList();

        }

        public void GetData() {
            var query = GetAll();
            var exp=Expression<
        }
    }
}
